using System;
using System.IO;
using System.Text;
using System.Collections;
using System.Collections.Generic;
using ClickSocial.Framework;
using ClickSocial.Data;
using ClickSocial.Entities;
using System.Web;
using System.Data;
using System.Configuration;

namespace ClickSocial.Components
{
    public class Destacados
    {
        static EventoDal _instance;

        #region Singleton
        public Destacados()
        {

        }

        public static EventoDal Instance()
        {
            if (_instance == null)
            {
                if (HttpContext.Current == null)
                    _instance = new EventoDal();
                else
                {
                    EventoDal inst = HttpContext.Current.Items["EventoDalSingleton"] as EventoDal;
                    if (inst == null)
                    {
                        inst = new EventoDal();
                        HttpContext.Current.Items.Add("EventoDalSingleton", inst);
                    }
                    return inst;
                }
            }
            return _instance;
        } 
        #endregion

        static public List<EventoInfo> GetAll()
        {
            return CBO.FillCollection<EventoInfo>(Instance().GetAllDestacados());
        }

        static public List<EventoInfo> GetAllPerm()
        {
            return CBO.FillCollection<EventoInfo>(Instance().GetAllDestacadosByPerm((int)TipoVisibilidad.Publico_ConAcceso));
        }

        static public void AgregarDestacado(long eventoId)
        {
            Instance().AgregarDestacado(eventoId);    
        }

        static public void QuitarDestacado(long eventoId)
        {
            Instance().QuitarDestacado(eventoId);
        }

        static public void OrdenDestacado(long eventoId, int orden)
        {
            Instance().OrdenDestacado(eventoId, orden);
        }

    }
}
